package a_02_wizhi.P_proxy.cglib;

import a_02_wizhi.P_proxy.PersonDao;
import a_02_wizhi.P_proxy.PersonDaoImpl;

/**
 * @author fanhb on 2017/9/2
 * @desc cglib 动态代理的测试类
 */
public class ProxyCglibTest {
    public static void main(String[] args) {
        Object target = new PersonDaoImpl();
        PersonDao personDao = (PersonDao) ProxyCglib.createProxy(target, ProxyCglibHandler.class);
        TestUser4Cglib user = (TestUser4Cglib) ProxyCglib.createProxy(new TestUser4Cglib(), ProxyCglibHandler.class);
        personDao.savePerson();

        user.getAge();
        user.getName();
        user.getNickName();
    }
}
